home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmMain
- BorderStyle = 3 'Fester Dialog
- Caption = "Guess The Number!"
- ClientHeight = 4620
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 5700
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4620
- ScaleWidth = 5700
- ShowInTaskbar = 0 'False
- StartUpPosition = 3 'Windows-Standard
- Begin VB.CommandButton cmdmyNumber
- Caption = "&It's my number"
- Height = 615
- Left = 1920
- TabIndex = 4
- Top = 3000
- Visible = 0 'False
- Width = 1695
- End
- Begin VB.CommandButton cmdHigher
- Caption = "&Higher"
- Height = 615
- Left = 3840
- TabIndex = 3
- Top = 3000
- Visible = 0 'False
- Width = 1695
- End
- Begin VB.CommandButton cmdLower
- Caption = "&Lower"
- Height = 615
- Left = 120
- TabIndex = 2
- Top = 3000
- Visible = 0 'False
- Width = 1575
- End
- Begin VB.CommandButton cmdStart
- Caption = "&Start"
- Height = 495
- Left = 1920
- TabIndex = 1
- Top = 3960
- Width = 1695
- End
- Begin VB.Label lblNumber
- Alignment = 2 'Zentriert
- BorderStyle = 1 'Fest Einfach
- Height = 615
- Left = 360
- TabIndex = 5
- Top = 1560
- Width = 4935
- End
- Begin VB.Label lblTitel
- Alignment = 2 'Zentriert
- Caption = "Think of a number!"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 24
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 735
- Left = 720
- TabIndex = 0
- Top = 240
- Width = 4215
- End
- Attribute VB_Name = "frmMain"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Try As Integer
- Private guessnumber As Integer
- Private divisor As Integer
- Const maxnumber = 32768
- Private Sub cmdHigher_Click()
- Try = Try + 1
- guessnumber = guessnumber + divisor
- divisor = divisor \ 2
- lblNumber.Caption = "Is it number" & guessnumber & "?"
- End Sub
- Private Sub cmdLower_Click()
- Try = Try + 1
- guessnumber = guessnumber - divisor
- divisor = divisor \ 2
- lblNumber.Caption = "Is it number" & guessnumber & "?"
- End Sub
- Private Sub cmdStart_Click()
- cmdHigher.Visible = True
- cmdLower.Visible = True
- cmdStart.Enabled = False
- cmdmyNumber.Visible = True
- lblTitel.Visible = False
- Try = 0
- guessnumber = maxnumber \ 2
- divisor = maxnumber \ 4
- lblNumber.Caption = "Is it number " & guessnumber & "?"
- End Sub
- Private Sub cmdmynumber_Click()
- MsgBox prompt:="Number guessed in " & Try & " tries"
- cmdHigher.Visible = False
- cmdLower.Visible = False
- cmdmyNumber.Visible = False
- lblTitel.Visible = True
- lblNumber.Caption = ""
- cmdStart.Enabled = True
- cmdStart.SetFocus
- End Sub
-